import {
    ACTION_SET_TRAINNUMBER,
    ACTION_SET_DEPARTSTATION,
    ACTION_SET_ARRIVESTATION,
    ACTION_SET_SEATTYPE,
    ACTION_SET_DEPARTDATE,
    ACTION_SET_ARRIVEDATE,
    ACTION_SET_DEPARTTIMESTR,
    ACTION_SET_ARRIVETIMESTR,
    ACTION_SET_DURATIONSTR,
    ACTION_SET_PRICE,
    ACTION_SET_PASSAGERS,
    ACTION_SET_MENU,
    ACTION_SET_ISMENUVISIBLE,
    ACTION_SET_SEARCHPARSED,
} from './actions';

export default {
    trainNumber(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_TRAINNUMBER:
                return payload;
            default:
                return prevState;
        }
    },
    departStation(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_DEPARTSTATION:
                return payload;
            default:
                return prevState;
        }
    },
    arriveStation(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_ARRIVESTATION:
                return payload;
            default:
                return prevState;
        }
    },
    seatType(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_SEATTYPE:
                return payload;
            default:
                return prevState;
        }
    },
    departDate(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_DEPARTDATE:
                return payload;
            default:
                return prevState;
        }
    },
    arriveDate(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_ARRIVEDATE:
                return payload;
            default:
                return prevState;
        }
    },
    departTimeStr(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_DEPARTTIMESTR:
                return payload;
            default:
                return prevState;
        }
    },
    arriveTimeStr(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_ARRIVETIMESTR:
                return payload;
            default:
                return prevState;
        }
    },
    durationStr(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_DURATIONSTR:
                return payload;
            default:
                return prevState;
        }
    },
    price(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_PRICE:
                return payload;
            default:
                return prevState;
        }
    },
    passengers(prevState = [], action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_PASSAGERS:
                return payload;
            default:
                return prevState;
        }
    },
    menu(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_MENU:
                return payload;
            default:
                return prevState;
        }
    },
    isMenuVisible(prevState = false, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_ISMENUVISIBLE:
                return payload;
            default:
                return prevState;
        }
    },
    searchParsed(prevState = false, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_SEARCHPARSED:
                return payload;
            default:
                return prevState;
        }
    },
};
